/**
  ******************************************************************************
  * @file    Bsp/button.h 
  * @author  zlf
  * @version V1.0.0
  * @date    2016-04-05
  * @brief   Header for button.c module
  
  ******************************************************************************
  */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __BUTTON_H
#define __BUTTON_H

/* Includes ------------------------------------------------------------------*/
	#include "main.h"

/* Exported constants --------------------------------------------------------*/
#define BTN_GPIO_OK 		  ( GPIOC )
#define BTN_GPIO_CANCEL 	( GPIOC )
#define BTN_GPIO_UP 	    ( GPIOC )
#define BTN_GPIO_DN 	    ( GPIOC )

 
#define BTN_PIN_0 		( GPIO_Pin_5 )   //
#define BTN_PIN_1 		( GPIO_Pin_7 )   //cancel
#define BTN_PIN_2 		( GPIO_Pin_8 )   //ok
#define BTN_PIN_3 		( GPIO_Pin_9 )   //up
#define BTN_PIN_4 		( GPIO_Pin_10 )  //DN

#define BTN_GPIO2 		( GPIOC )


/* Exported macro ------------------------------------------------------------*/
#define BTN_0_IN 		( GPIO_ReadInputDataBit(BTN_GPIO_CANCEL, BTN_PIN_0) )    
#define BTN_1_IN 		( GPIO_ReadInputDataBit(BTN_GPIO_OK, BTN_PIN_1) )       //cancel
#define BTN_2_IN 		( GPIO_ReadInputDataBit(BTN_GPIO_UP, BTN_PIN_2) )       //ok
#define BTN_3_IN 		( GPIO_ReadInputDataBit(BTN_GPIO2, BTN_PIN_3) )         //up
#define BTN_4_IN 		( GPIO_ReadInputDataBit(BTN_GPIO_DN, BTN_PIN_4) )       //DN
 
#define BTN_CANCEL_IN 	BTN_1_IN 
#define BTN_OK_IN 		  BTN_2_IN
#define BTN_UP_IN 		  BTN_3_IN 
#define BTN_DOWN_IN 	  BTN_4_IN 
#define BTN_SHIFT_IN 	  BTN_0_IN 

#define BTN_PRESSED  	( Bit_RESET ) //Bit_RESET


/* Exported functions --------------------------------------------------------*/

extern void Button_Init(void);

#endif /* __BUTTON_H */
 
 

